BIN=mytest
#SRC=$(shell ls *.c)
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
CC=gcc
RM=rm -f

$(BIN):$(OBJ)
	@$(CC)  $^ -o $@
	@echo "链接 $^ 成 $@"
%.o:%.c
	@$(CC) -c $<
	@echo "编译 ... $< 成 $@"

.PHONY:clean
clean:
	@$(RM) $(OBJ) $(BIN)

.PHONY:test
test:
	@echo $(BIN)
	@echo $(SRC)
	@echo $(OBJ)

#$(BIN):$(OBJ) 
#	gcc $(OBJ) -o $(BIN)
#$(OBJ):$(SRC)
#	gcc -c $(SRC) -o $(OBJ)
#
#.PHONY:clean
#clean:
#	$(RM) $(BIN) $(OBJ)


#mytest:mytest.o
#	gcc mytest.o -o mytest
#mytest.o:test.c
#	gcc -c test.c -o mytest.o
#
#.PHONY:clean
#clean:
#	rm -f *.o mytest
#


#mytest:test.o 
#	gcc test.o -o mytest
#test.o:test.s
#	gcc -c test.s -o test.o
#test.s:test.i
#	gcc -S test.i -o test.s
#test.i:test.c
#	gcc -E test.c -o test.i
#
#.PHONY:clean
#clean:
#	rm -f *.i *.s *.o mytest


#mytest: test.c
#	gcc test.c -o mytest
#
#.PHONY:clean
#clean
#rm -f mytest


#适度扩展语法




